import service from "@/services/interceptor";
import { homeDataUrl, deviceDataUrl, elevatorDetail } from '@/constants/url.constants'

export const getHomeData = async (filterBody: any) => {
    const [homeData, elevators] = await Promise.all([
        service.get(homeDataUrl).then(res => res.data.data),
        service.post(deviceDataUrl, { body: filterBody }).then(res => res.data.data)
    ])

    return {
        homeData,
        elevators
    };
}

export const getDetailData = async (id: string) => {
    return service.get(elevatorDetail(id)).then(res => res.data.data);
}